package com.hl.common.config;

import com.hl.common.interceptor.JWTInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 朱炫达
 */
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    private JWTInterceptor jwtInterceptor;
    @Autowired
    public void setRedisTemplate(JWTInterceptor jwtInterceptor){
        this.jwtInterceptor = jwtInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor).addPathPatterns(
                "/api/cms/send_password_email",

                "/api/core/add_video",

                "/api/core/user_logout",
                "/api/core/get_user_info",
                "/api/core/update_user_info",
                "/api/core/check_update_password_code/**",
                "/api/core/update_password/**",
                "/api/core/update_avatar",

                "/api/core/video_operation/**"
        );
    }
}